<div id="main-content">
    <div class="box border grey ">
        <div class="box-title">
            <h4>
                <i class="fa fa-book" ng-if="!showBackButton()"></i>
                <i class="fa  fa-arrow-left" ng-if="showBackButton()" ng-click="back(1)"></i>
                公司列表
                <span ng-if="toState.name=='addcompany'">>>添加公司</span>
                <span ng-if="toState.name=='companydetail'||toState.name=='companycalendar'||toState.name=='companytask'||toState.name=='companycontact'||toState.name=='companycontactdetail'">>>{{presentCompanyInfo.companyBaseInfo.name}}</span>
                <!--<span ng-if="chevronLeft||chevronRight">>>{{presentContactInfo.baseInfo.name}}</span>-->
            </h4>
        <div class="box-body" style="overflow:auto">
            <div data-ui-view="companycontent">
                <div class="row" >
                    <div style="padding-right: 3px" class="col-md-4" >
                        <div class="box border blue">
                            <div class="box-title text-center"><h4>检索</h4></div>
                            <div class="box-body" style="height: 480px">
                                <div class="row btn-group" style="display: block;margin-left: 0;margin-right: 0">
                                    <div class="col-md-1 text-center" style="padding-left: 0;padding-right: 0">
                                        <a ng-init="showSearch=1" ng-click="showSearch=1" data-toggle="tooltip" title="检索"><i class="fa fa-search fa-2x"></i></a>
                                    </div>
                                    <div class="col-md-9" ng-show="showSearch==1" style="padding-left: 0;padding-right: 0">
                                        <input type="text" class="form-control" ng-model="filterInfos.name" ng-disabled="showHierarchy" placeholder="{{showHierarchy?'不分层级展示才能使用此区域功能':'请输入要检索的公司名称'}}" data-toggle="tooltip" title="{{showHierarchy?'只有不分层级展示才能使用此功能':''}}">
                                    </div>
                                    <div class="col-md-1 text-center" style="padding-left: 0;padding-right: 0">
                                        <a ng-click="showSearch=2" data-toggle="tooltip" title="排序"><i class="fa fa-sort-amount-asc fa-2x"></i></a>
                                    </div>
                                    <div class="col-md-9" ng-show="showSearch==2" style="padding-right: 0" data-toggle="tooltip" title="{{showHierarchy?'只有不分层级展示才能使用此功能':''}}">
                                        <div class="row">
                                            <a ng-disabled="showHierarchy" class="btn btn-xs btn-default" style="width: 30%" ng-init="nameUp=true;nameOrder=true" ng-click="nameOrder=true;engNameOrder=false;aliasOrder=false;nameUp=!nameUp;sortByElement('name',nameUp)">公司名<i ng-show="nameOrder" class="fa fa-sort-alpha-{{nameUp?'asc':'desc'}}"></i></a>
                                            <a ng-disabled="showHierarchy" class="btn btn-xs btn-default" style="width: 30%" ng-init="engNameUp=false;engNameOrder=false" ng-click="nameOrder=false;engNameOrder=true;aliasOrder=false;engNameUp=!engNameUp;sortByElement('englishName',engNameUp)">英文名<i ng-show="engNameOrder" class="fa fa-sort-alpha-{{engNameUp?'asc':'desc'}}"></i></a>
                                            <a ng-disabled="showHierarchy" class="btn btn-xs btn-default" style="width: 30%" ng-init="aliasUp=true;aliasOrder=false" ng-click="nameOrder=false;engNameOrder=false;aliasOrder=true;aliasUp=!aliasUp;sortByElement('alias',aliasUp)">别名<i ng-show="aliasOrder" class="fa fa-sort-alpha-{{aliasUp?'asc':'desc'}}"></i></a>
                                        </div>
                                    </div>
                                    <div class="col-md-1 text-center" style="padding-left: 0;padding-right: 0">
                                        <a ng-click="showSearch=3" data-toggle="tooltip" title="导入/导出"><i class="fa fa-upload fa-2x"></i></a>
                                    </div>
                                    <div class="col-md-9" ng-show="showSearch==3" style="padding-left: 0;padding-right: 0">
                                        <div class="row">
                                            <div class="col-md-6">
                                                <button type="file"  ngf-select="upExcel($file)" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" ngf-max-height="1000" ngf-max-size="10MB" style="width:100%" class="btn btn-default">
                                                    <span>导入</span>
                                                    <i class="fa fa-upload"></i>
                                                </button>
                                            </div>
                                            <div class="col-md-6">
                                                <a class="btn btn-default" style="width: 100%" ng-click="downExcel()">导出<i class="fa fa-download"></i></a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="text-center" style="margin-top: 15px" ng-init="showHierarchy=true">
                                    <input type="button" class="btn btn-success" style="margin-right: 15px" ng-click="showHierarchy=true" value="分层级显示">
                                    <input type="button" class="btn btn-warning" style="margin-left: 15px" ng-click="showHierarchy=false" value="不分层显示">
                                </div>
                                <div style="padding-right:0;padding-left: 0;margin-left:0;margin-top: 15px">
                                    <h6 style="margin-left: 0">商业联系:</h6>
                                </div>
                                <div class="row btn-group" style="margin-left: 0;margin-right: 0" data-toggle="tooltip" title="{{showHierarchy?'只有不分层级展示才能使用此功能':''}}">
                                    <a ng-disabled="showHierarchy" style="padding-right: 9px;padding-left: 9px" class="btn btn-{{filterInfos.businessConnection.kh?'primary':'default'}}" ng-click="filterInfos.businessConnection.kh=!filterInfos.businessConnection.kh">客户</a>
                                    <a ng-disabled="showHierarchy" style="padding-right: 9px;padding-left: 9px" class="btn btn-{{filterInfos.businessConnection.hzhb?'info':'default'}}" ng-click="filterInfos.businessConnection.hzhb=!filterInfos.businessConnection.hzhb">合作伙伴</a>
                                    <a ng-disabled="showHierarchy" style="padding-right: 9px;padding-left: 9px" class="btn btn-{{filterInfos.businessConnection.jzds?'danger':'default'}}" ng-click="filterInfos.businessConnection.jzds=!filterInfos.businessConnection.jzds">竞争对手</a>
                                    <a ng-disabled="showHierarchy" style="padding-right: 9px;padding-left: 9px" class="btn btn-{{filterInfos.businessConnection.gys?'warning':'default'}}" ng-click="filterInfos.businessConnection.gys=!filterInfos.businessConnection.gys">供应商</a>
                                    <a ng-disabled="showHierarchy" style="padding-right: 9px;padding-left: 9px" class="btn btn-{{filterInfos.businessConnection.qt?'success':'default'}}" ng-click="filterInfos.businessConnection.qt=!filterInfos.businessConnection.qt">其他</a>
                                </div>
                                <div style="padding-right:0;padding-left: 0;margin-left:0;margin-top: 15px">
                                    <h6 style="margin-left: 0">重要程度:</h6>
                                </div>
                                <div class="row btn-group" style="margin-left: 0;margin-right: 0" data-toggle="tooltip" title="{{showHierarchy?'只有不分层级展示才能使用此功能':''}}">
                                    <a ng-disabled="showHierarchy" style="padding-right: 10px;padding-left: 10px" class="btn btn-{{filterInfos.importance.bxy?'success':'default'}}" ng-click="filterInfos.importance.bxy=!filterInfos.importance.bxy">不需要</a>
                                    <a ng-disabled="showHierarchy" style="padding-right: 10px;padding-left: 10px" class="btn btn-{{filterInfos.importance.xy?'info':'default'}}" ng-click="filterInfos.importance.xy=!filterInfos.importance.xy">需要</a>
                                    <a ng-disabled="showHierarchy" style="padding-right: 12px;padding-left: 12px" class="btn btn-{{filterInfos.importance.zy?'warning':'default'}}" ng-click="filterInfos.importance.zy=!filterInfos.importance.zy">重要</a>
                                    <a ng-disabled="showHierarchy" style="padding-right: 10px;padding-left: 10px" class="btn btn-{{filterInfos.importance.hzy?'primary':'default'}}" ng-click="filterInfos.importance.hzy=!filterInfos.importance.hzy">很重要</a>
                                    <a ng-disabled="showHierarchy" style="padding-right: 10px;padding-left: 10px" class="btn btn-{{filterInfos.importance.jqzy?'danger':'default'}}" ng-click="filterInfos.importance.jqzy=!filterInfos.importance.jqzy">极其重要</a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div style="padding-left: 3px" class="col-md-8 " >
                        <div ng-show="showHierarchy" class="box border green" >
                            <div class="box-title text-center">
                                <h4>层级展示</h4>
                                <span>
                                    （只显示总公司
                                    <input type="checkbox"  ng-model="onlyTop">
                                    ）
                                </span>
                                <div style="float: right">
                                    <a ng-click="toState.name=='company'?addCompany():addCompany(presentCompanyInfo.id)"><i class="fa fa-plus"></i></a>
                                </div>
                            </div>
                            <div ng-show="companyInfos.length==0">您还没有添加任何公司，快点击右上角的<i class="fa fa-plus"></i>添加一个吧</div>
                            <div>
                                <div recursion-element style="height: 480px;overflow: auto" class="box-body tree tree-selectable" rep="companyInfos" delete-function="deleteCompany(id)" add-function="addCompany(id)" change-function="changeCompany(id)" template="scripts/components/myself/company/companyNamesItem/companyNamesItem.html" only-top="{{onlyTop}}"></div>
                            </div>
                        </div>
                        <div ng-show="!showHierarchy" class="box border orange" >
                            <div class="box-title text-center">
                                <h4>名称排列</h4>
                                <div style="float: right">
                                    <a ng-click="toState.name=='company'?addCompany():addCompany(presentCompanyInfo.id)"><i class="fa fa-plus"></i></a>
                                </div></div>
                            <div ng-show="companyInfos.length==0">您还没有添加任何公司，快点击右上角的<i class="fa fa-plus"></i>添加一个吧</div>
                            <div class="box-body"  style="height: 480px;overflow: scroll">
                                <table class="table">
                                    <thead>
                                        <tr>
                                            <th>公司名称</th>
                                            <th>公司简称</th>
                                            <th>英文名称</th>
                                            <th></th>
                                        </tr>
                                    </thead>
                                    <tbody ng-init="showTrash=-1">
                                        <tr class="" ng-repeat="item in sortedCompanyInfos|filter:infosFilter" ng-mouseenter="showTrash=$index" ng-mouseleave="showTrash=-1" ng-click="changeCompany(item.id)">
                                            <td><b>{{item.companyBaseInfo.name}}</b></td>
                                            <td>
                                                <span style="color: #10a54a" ng-if="item.companyBaseInfo.alias!=undefined&&item.companyBaseInfo.alias!=''">
                                                    &nbsp;&nbsp;{{item.companyBaseInfo.alias!=""?item.companyBaseInfo.alias:""}}&nbsp;&nbsp;
                                                </span>
                                            </td>
                                            <td>
                                                <span ng-if="item.companyBaseInfo.englishName!=undefined&&item.companyBaseInfo.englishName!=''">
                                                    &nbsp;&nbsp;
                                                    <i style="color: #2ea8e5">{{item.companyBaseInfo.englishName}}</i>
                                                </span>
                                            </td>
                                            <td>
                                                <span ng-show="showTrash==$index">
                                                    <a ng-click="deleteCompany(item.id)"><i class="fa fa-trash-o"></i></a>
                                                    <a ng-click="addCompany(item.id)"><i class="fa fa-plus"></i></a>
                                                </span>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <!--<repeat-datastruct info-struct="dataStruct.testInfo" info-traversal="infos" blockname="test"></repeat-datastruct>
        <table>
            <tr ng-repeat="item in infos">
                <td ng-repeat="ele in item">{{ele}}</td>
            </tr>
        </table>-->
        </div>
    </div>
</div>